using System;
using System.Collections.Generic;


namespace SpringNH.Model
{
	[Serializable]
	public class Rssurl: IEquatable<Rssurl>
	{

		#region Private Members

		private string _url; 
		private string _name; 		
		#endregion

		#region Constructor

		public Rssurl()
		{
			_url = String.Empty; 
			_name = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Rssurl(
			string url, 
			string name)
			: this()
		{
			_url = url;
			_name = name;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string Url
		{
			get
			{ 
				return _url;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Url", value, "null");
				
				if(  value.Length > 100)
					throw new ArgumentOutOfRangeException("Invalid value for Url", value, value.ToString());
				
				_url = value;
			}
		}
			
		public virtual string Name
		{
			get
			{ 
				return _name;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Name", value, "null");
				
				if(  value.Length > 45)
					throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
				
				_name = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Rssurl castObj = (Rssurl)obj; 
			return ( castObj != null ) &&
				( this._url == castObj.Url );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _url.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Rssurl other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._url == other.Url );
				   
		}

		#endregion
		
	}
}
